<div class="title">
	<span>View Order</span>
	<div class="clear">&nbsp;</div>
</div>

<div class="margin">
<?php flash(); // display flash data?>

<?php echo form_fieldset('Customer Data'); ?>
		<h5>Name: <?php echo $user->lastname.', '. $user->firstname?></h5>
		<p class="user_details">
			<span>Contact: <?php echo $user->contact;?> </span>
			<span>Email: <?php echo $user->email; ?></span>
		</p>
<?php echo form_fieldset_close();?>

<?php
	if(!empty($items)){
	
	$tmpl = array ( 'table_open'  => '<table border="1" cellpadding="2" cellspacing="1" class="tbl-list" id="tbl-list">' );
	$this->table->set_heading('Product', 'Qty', 'Price', 'Sub Total');
	$this->table->set_template($tmpl);
	$total = 0;
	foreach($items as $v){
					
		$total = $total+$v->od_total;
		$data = array(
				$v->name,
				$v->qty,
				$v->price,
				$v->od_total
				
		);
		$this->table->add_row($data);	
	}
	$table = $this->table->generate();
	echo $table;
	echo '<div class="total">
		<div class="proof-payment">
			<h5>Proof of payment</h5>
			<img src="'.site_url().'/'.$order_data->proof.'" width="80px" height="80px">
		</div>
		<div class="total-block">
		<h5>Total: <span>'.$total.'</span></h5>
		</div>
		<div class="clear">&nbsp;</div>
		</div>';
	echo form_fieldset('Order Status');
	echo form_open();
	echo '<input type="hidden" name="order_id" value="'.$order_id.'">';
	echo form_hidden('email', $user->email);
	echo form_hidden('html_items', $table.'<br/><br/> <h2>Total: '.$total.'</h2>');
	$pending ='';
	$accepted = '';
	$rejected = '';
	if($order_data->status == 'Pending')
		$pending = 'selected="selected"';
	else if($order_data->status == 'Accepted')
		$accepted = 'selected="selected"';
	else if($order_data->status == 'Rejected')
		$rejected = 'selected="selected"';
	echo '<select name="action"><option value="Pending" '.$pending.'>Pending</option><option value="Accepted" '.$accepted.'>Accepted</option><option value="Rejected" '.$rejected.'>Rejected</option></select>';
	echo form_submit(array('name' => 'save', 'value' => 'Save', 'class' => 'fbtn add'));
	echo form_close();
	echo form_fieldset_close();
	}
	
	
	else {
		echo '<div class="msg notice"><span></span><h5>Notice</h5>No purchases made yet.</div>';	
	}
?>


<a href="<?php echo site_url('admin/orders/')?>" class="back-btn"><span>Back</span></a>
</div>